package com.zhangyu;

import org.eclipse.milo.opcua.stack.core.AttributeId;
import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName;
import org.eclipse.milo.opcua.stack.core.types.enumerated.MonitoringMode;
import org.eclipse.milo.opcua.stack.core.types.structured.MonitoredItemCreateRequest;
import org.eclipse.milo.opcua.stack.core.types.structured.MonitoringParameters;
import org.eclipse.milo.opcua.stack.core.types.structured.ReadValueId;

import java.util.ArrayList;
import java.util.List;

public class GHLZMonitoredNode {
    public static List<MonitoredItemCreateRequest> getGHLZMonitoredNode(MonitoringParameters parameters) {

        ReadValueId counter1Id = new ReadValueId(new NodeId(5, "Counter1"), AttributeId.Value.uid(), null,
                QualifiedName.NULL_VALUE);
        ReadValueId random1Id = new ReadValueId(new NodeId(5, "Random1"), AttributeId.Value.uid(), null,
                QualifiedName.NULL_VALUE);
        ReadValueId sinusoid11Id = new ReadValueId(new NodeId(5, "Sinusoid1"), AttributeId.Value.uid(), null,
                QualifiedName.NULL_VALUE);
        ReadValueId square1Id = new ReadValueId(new NodeId(5, "Square1"), AttributeId.Value.uid(), null,
                QualifiedName.NULL_VALUE);
        ReadValueId sawtooth1Id = new ReadValueId(new NodeId(5, "Sawtooth1"), AttributeId.Value.uid(), null,
                QualifiedName.NULL_VALUE);
        ReadValueId triangle1Id = new ReadValueId(new NodeId(5, "Triangle1"), AttributeId.Value.uid(), null,
                QualifiedName.NULL_VALUE);
        ReadValueId expression1Id = new ReadValueId(new NodeId(5, "Expression1"), AttributeId.Value.uid(), null,
                QualifiedName.NULL_VALUE);

        MonitoredItemCreateRequest counter1Request = new MonitoredItemCreateRequest(counter1Id, MonitoringMode.Reporting,
                parameters);
        MonitoredItemCreateRequest random1Request = new MonitoredItemCreateRequest(random1Id, MonitoringMode.Reporting,
                parameters);
        MonitoredItemCreateRequest sinusoid1Request = new MonitoredItemCreateRequest(sinusoid11Id, MonitoringMode.Reporting,
                parameters);
        MonitoredItemCreateRequest square1Request = new MonitoredItemCreateRequest(square1Id, MonitoringMode.Reporting,
                parameters);
        MonitoredItemCreateRequest sawtooth1Request = new MonitoredItemCreateRequest(sawtooth1Id, MonitoringMode.Reporting,
                parameters);
        MonitoredItemCreateRequest triangle1Request = new MonitoredItemCreateRequest(triangle1Id, MonitoringMode.Reporting,
                parameters);
        MonitoredItemCreateRequest expression1Request = new MonitoredItemCreateRequest(expression1Id, MonitoringMode.Reporting,
                parameters);

        List<MonitoredItemCreateRequest> nodesToRead = new ArrayList<>();
        nodesToRead.add(counter1Request);
        nodesToRead.add(random1Request);
        nodesToRead.add(sinusoid1Request);
        nodesToRead.add(square1Request);
        nodesToRead.add(sawtooth1Request);
        nodesToRead.add(triangle1Request);
        nodesToRead.add(expression1Request);

        return nodesToRead;

    }
}